/*
 * @Author: AskMeWhy
 * @Date: 2020-12-03 09:56:54
 * @Last Modified by: AskMeWhy
 * @Last Modified time: 2020-12-03 16:54:13
 */
export default (Vue: any) => {
    Vue.directive("auto-focus", {
        inserted: function(el: any) {
            const inputEl = document.createElement("input");
            inputEl.style.cssText =
                "height:0;padding:0;border:none;outline:none;margin:0";
            el.appendChild(inputEl);
            setTimeout(() => {
                inputEl.focus();
                el.removeChild(inputEl);
            }, 0);
        }
    });
};
